﻿namespace SoldiHive.Infrustructure.Extensions
{
	public static class StringExtensions
	{
		public static string Align(this string me, int length)
		{
			return me.Align(" ", length);
		}

		public static string Align(this string me, string placeHolder, int length)
		{
			if (me.Length == length)
			{
				return me;
			}

			if (me.Length > length)
			{
				return me.Substring(0, length);
			}

			var alignedString = me;
			while (alignedString.Length < length)
			{
				alignedString += placeHolder;
			}

			return alignedString;
		}
	}
}
